<?php
/**
 * aheadWorks Co.
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the EULA
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://ecommerce.aheadworks.com/LICENSE-M1.txt
 *
 * @category   AW
 * @package    AW_Mobile
 * @copyright  Copyright (c) 2010-2011 aheadWorks Co. (http://www.aheadworks.com)
 * @license    http://ecommerce.aheadworks.com/LICENSE-M1.txt
 */
?>
<?php $_order = $this->getOrder() ?>
<div class="page-head button-level">
    <h2><?php echo $this->__('My Orders - Details') ?></h2>
    <button class="form-button"><span><?php echo $this->__('Print All Invoices') ?></span></button>
</div>
<h3><?php echo $this->__('Order #%s', $_order->getRealOrderId()) ?></h3>
<?php foreach ($this->getInvoices() as $_invoice): ?>
    <div class="divider"></div>
    <div class="head">
        <h3><?php echo $this->__('Invoice #%s', $_invoice->getIncrementId()) ?></h3>
        <a href="#"><?php echo $this->__('Print Invoice') ?></a>
    </div>
    <div class="col2-set">
        <div class="col-1">
            <h4><?php echo $this->__('Shipping Address') ?></h4>
            <?php $_shipping = $_invoice->getShippingAddress() ?>
            <address><?php echo $_shipping->getFirstname() ?> <?php echo $_shipping->getLastname() ?><br />
            <?php echo $_shipping->getCompany() ?><br />
            <?php echo $_shipping->getStreet() ?><br />
            <?php echo $_shipping->getCity() ?>, <?php echo $_shipping->getRegion() ?> <?php echo $_shipping->getPostcode() ?><br />
            <strong>T</strong> | <?php echo $_shipping->getTelephone();
            if ($_shipping->getFax()): ?><br /><strong>F</strong> | <?php echo $_shipping->getFax() ?><?php endif; ?></address>
        </div>
        <div class="col-2">
            <h4><?php echo $this->__('Billing Address') ?></h4>
            <?php $_billing = $_invoice->getbillingAddress() ?>
            <address><?php echo $_billing->getFirstname() ?> <?php echo $_billing->getLastname() ?><br />
            <?php echo $_billing->getCompany() ?><br />
            <?php echo $_billing->getStreet() ?><br />
            <?php echo $_billing->getCity() ?>, <?php echo $_billing->getRegion() ?> <?php echo $_billing->getPostcode() ?><br />
            <strong>T</strong> | <?php echo $_billing->getTelephone();
            if ($_billing->getFax()): ?><br /><strong>F</strong> | <?php echo $_billing->getFax() ?><?php endif; ?></address>
        </div>
    </div>
    <br />
    <div class="col2-set">
        <div class="col-1">
            <h4><?php echo $this->__('Shipping Method') ?></h4>
            <?php echo $_order->getShippingMethod() ?> <?php echo $_order->getShippingDescription() ?>
        </div>
        <div class="col-2">
            <h4><?php echo $this->__('Payment Method') ?></h4>
            <?php $_payment = $_order->getPayment() ?>
            <?php echo $_payment->getMethod() ?>: <?php echo $_payment->getCcType() ?> xxxx<?php echo $_payment->getCcLast4() ?>
        </div>
    </div>

<div class="page-head"><h4><?php echo $this->__('Items Ordered') ?></h4></div>
    <table cellspacing="0" class="data-table">
<!--        <thead>
            <tr>
                <th><?php echo $this->__('Product Name') ?></th>
                <th class="a-right" width="15%"><?php echo $this->__('Price') ?></th>
                <th class="a-center" width="10%"><?php echo $this->__('Qty Ordered') ?></th>
                <th class="a-center" width="10%"><?php echo $this->__('Qty Shipped') ?></th>
                <th class="a-right" width="20%"><?php echo $this->__('Subtotal') ?></th>
            </tr>
        </thead> -->
        <tbody>
            <?php $_items = $_invoice->getItemsCollection(); ?>
            <?php $_count = $_items->count(); ?>
            <?php $_index = 0; ?>
            <?php foreach ($_items as $_item): ?>
                <tr<?php echo ($_index++ > $_count ? ' class="last"' : '') ?>>
                <td><?php echo $this->htmlEscape($_item->getProductName()) ?></td>
                <td class="a-right nowrap"><?php echo $_order->formatPrice($_item->getPrice()*1) ?></td>
                <td class="a-center"><?php echo $_item->getQty()*1 ?></td>
                <td class="a-center"><?php echo $_item->getQty()*1 ?></td>
                <td class="last a-right nowrap"><?php echo $_order->formatPrice($_item->getRowTotal()*1) ?></td>
            <?php endforeach; ?>
            </tr>
        </tbody>
        <tfoot>
            <tr>
                <td colspan="4" class="a-right"><?php echo $this->__('Order Subtotal') ?></td>
                <td class="last a-right"><?php echo $_order->formatPrice($_invoice->getSubtotal()) ?></td>
            </tr>
        </tfoot>
    </table>
    <br/>
<?php endforeach; ?>
